package com.example;

public class da {
    public static void main(String[] args) {
        System.out.println(getSum(10));
    }
    //计算n个斐波那契数列的和
    public static int getSum(int number) {
        int sum = 0;
        for (int i = 1; i <= number; i++) {
            sum += getFibonacci(i);
        }
        return sum;
    }
        private static int getFibonacci(int number) {
            if (number <= 2) {
                return 1;
            }
            return getFibonacci(number - 1) + getFibonacci(number - 2);
        }
}
